
#import "MiscAppFontDefaults.h"

//--------------------------------------------------------------------------------------
	@implementation Application(MiscAppFontDefaults)
//--------------------------------------------------------------------------------------
	
	/*" Extension of the methods of the #MiscAppDefaults category. Allows for saving
		font information in the defaults database. N.B.: The name of the font must
		not be longer than 300 characters. "*/

//--------------------------------------------------------------------------------------
	- (Font *)defaultFont:(const char *)defName;
//--------------------------------------------------------------------------------------
	
	/*" Returns the font stored in the defaults database with the name #defName 
		"*/

	{
	const char	*defValue;
	char		fontName[300];
	float		fontSize;
	
	defValue=[NXApp defaultValue:defName];
	if(!defValue)
		return nil;
	sscanf(defValue,"%s %f",fontName,&fontSize);
	return [Font newFont:fontName size:fontSize];
	}


//--------------------------------------------------------------------------------------
	- setDefault:(const char *)defName toFont:(Font *)font;
//--------------------------------------------------------------------------------------

	/*" Stores the font in the default database. "*/

	{
	char	defValue[300];
	
	sprintf(defValue,"%s %fpt",[font name],[font pointSize]);
	[NXApp setDefault:defName to:defValue];	
	return self;
	}
	
//--------------------------------------------------------------------------------------
	@end
//--------------------------------------------------------------------------------------
